asymptotic notation gate problems